DINGO backup
This service is used to configure and manage the backup of the DINGO databases.
The backup-service can be installed on the "Services" tab within the DINGO-Manager. The backup-service can also be installed from a SSH terminal with this command: sudo sh -c "$(curl -s http://apps.control2net.com/apt/install-dingo-backup)"
If the service does not exist, then create it with the properties, described below.
Name: DINGO backup
Tag: Other
Description: Backup and upload of DINGO databases
Type: Other
Configuration file: /opt/GoIoT/DinGo/bin/general/rn_dingo_backup_and_upload.conf
Log command: cat /var/log/messages | grep 'GoIoT: DINGO Backup'
Install command: sudo sh -c "$(curl -s http://apps.control2net.com/apt/install-dingo-backup)"
Start command: /opt/GoIoT/DinGo/bin/general/rn_dingo_backup_and_upload.sh
Stop command:
Restart command:
Status command: grep -F 'rn_dingo_backup_and_upload.sh' /etc/crontab && (cat /etc/crontab | grep rn_dingo_backup_and_upload.sh | grep '#' && echo '(dead)' || echo '(running)') || echo '(dead)'
Enable command:
Disable command:
Configuration
To configure the backup-service ; select the backup-service and click the "Main config. file..." button. See screenshot.
The only configuration necessary is the FTP setup (username, password, server and directory). All other configuration properties are good with their default values.
The configuration items are:
- backup_dir: This is the directory where the backup-file will be written to. /dev/shm/ is a directory mounted into memory, so the file will not be written to disk. This solution is used, because the backup-file will be transferred to a remote server, after creation and not stored locally.
-
backup_dingo_stack_database: This property can be true or false and determines if a backup should be taken of the DINGO-Stack database.
- backup_file: This is the name, that the backup-file of the DINGO-Stack database will get.
- backup_url: This is the web-service URL, that will generate the backup of the DINGO-Stack database. It is used with a PUT request. This property should not be changed.
- backup_lorawan_server_database: This property can be true or false and determines if a backup should be taken of the DINGO LoRaWAN Server database.
- lorawan_backup_file: This is the name, that the backup-file of the DINGO LoRaWAN Server database will get.
- lorawan_backup_url: This is the web-service URL, that will generate the backup of the DINGO LoRaWAN Server database. It is used with a PUT request. This property should not be changed.
- backup_rotations: If a backup rotation of 2 is used, then the first backup-file will get ".1" appended to the name. The second backup will get ".2" appended to the name. And the third will get ".1" appended again - and so the rotation will go in circles. This means that there will be 2 backup-files, where one will be newer than the other. If no backup rotation is used, then nothing will be appended to the backup-file and there will be only one backup-file.
- use_compression: If compression is used, then the backup-file will be compressed and ".tar.gz" will be appended to the backup-file name.
- ftp_username: This is the username used, when uploading the backup-file to the remote FTP server.
- ftp_password: This is the passsword used, when uploading the backup-file to the remote FTP server.
- ftp_server: This is the IP address of the remote FTP server.
- ftp_dir: Directory on the remote FTP server, that the backup-file should be uploaded to.
Any changes to the configuration file will take immediate effect.
This is the standard content of the configuration file:
Crontab configuration (scheduled backup)
The frequency of the backup-service is defined by the crontab service. Add this entry to the cron-table (crontab), to do the backup daily, at 6:15 AM:
15 6 * * * root /opt/GoIoT/DinGo/bin/general/rn_dingo_backup_and_upload.sh
FTP Alternative
The backup-service is a shell-script that will take a backup of the DINGO databases and upload the backup to a FTP server.
If there is a need to use something else than FTP, then the script can be edited to use something else. This is of course for advanced users.
Connect to the DINGO device via SSH terminal ( e.g. https://www.putty.org/) and follow these instructions:
- sudo nano /opt/GoIoT/DinGo/bin/general/rn_dingo_backup_and_upload.sh
-
At the top of the file, there is a function that contains the FTP code. Here the necessary changes can be made:
...# This function takes one parameter, the name file that should be uploaded via FTPfunction uploadToFTP(){ftp -n $ftp_server <<END_SCRIPTquote USER $ftp_usernamequote PASS $ftp_passwordbinarycd $ftp_dirput $backup_dir$1 $HOSTNAME.$1quitEND_SCRIPT}... - CTRL + X to close, hit Y to save changes.